home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 051-075 / disk_056 / mcad / tdp / source / tdp.h < prev    next >
C/C++ Source or Header  |  1992-05-06  |  4KB  |  150 lines

  1. /* tdp.h */
  2.  
  3. #include <stdio.h>
  4. #include <exec/types.h>
  5. #include <exec/lists.h>
  6. #include <intuition/intuition.h>
  7. #include <graphics/text.h>
  8. #include "ffp.h"
  9.  
  10. #define MAXCHAN 64
  11. #define MAXPOINTS (MAXCHAN * MAXCHAN)
  12. #define RLARGE 1.E10
  13. #define DEG2RAD (PI/180.)
  14. #define MAXHORIZ 600
  15. #define MAXVERT 380
  16. #define TOPVERT 400
  17. #define RESET 0
  18. #define UP 1
  19. #define DOWN -1
  20. #define DATA 1
  21. #define INTERP 2
  22. #define BIGINT 2147483000
  23. #define BACKGND_COLOR 0
  24. #define PASS_0_COLOR 1
  25. #define PASS_1_COLOR 3
  26. #define AXIS_COLOR 2
  27.  
  28. void pen();
  29. void hlplot();
  30. void hlcross();
  31. void plot3d();
  32. void calc();
  33. char *getwrd();
  34. void initwind();
  35. void CleanUp();
  36. extern struct GfxBase *GfxBase;
  37. extern struct IntuitionBase *IntuitionBase;
  38.  
  39. # ifdef MAIN_MODULE
  40. FFP zd[MAXPOINTS], d2r;
  41. FFP xA[4], yA[4], zA[4]; /* AXES */
  42. int xA_i[4], yA_i[4];
  43. FFP sinp, cosp, sint, cost;
  44. int x[MAXCHAN][MAXCHAN], y[MAXCHAN][MAXCHAN];
  45. short vhicum[MAXHORIZ], vlocum[MAXHORIZ];
  46. int debug = 0, inverse_vid = 0, nsides = 1;
  47. int PlotFile = FALSE, To_mCAD = FALSE;
  48. FILE *pfp, *mfp;
  49. char ans, str[20];
  50. FFP phi, theta;
  51. int nxpts=0, nypts=0;
  52. char netplot='y', axes='n';
  53. struct Window *OpenWindow();
  54. struct Screen *OpenScreen();
  55. USHORT class, code;
  56. struct Window *w;
  57. struct RastPort *rp;
  58. struct ViewPort *vp;
  59. struct IntuiMessage *message;
  60. struct Screen *screen;
  61. # else
  62.  
  63. extern FFP zd[MAXPOINTS], d2r;
  64. extern FFP xA[], yA[], zA[]; /* AXES */
  65. extern int xA_i[], yA_i[];
  66. extern FFP sinp, cosp, sint, cost;
  67. extern int x[MAXCHAN][MAXCHAN], y[MAXCHAN][MAXCHAN];
  68. extern short vhicum[MAXHORIZ], vlocum[MAXHORIZ];
  69. extern int debug, inverse_vid, nsides;
  70. extern int PlotFile, To_mCAD;
  71. extern FILE *pfp, *mfp;
  72. extern char ans, str[];
  73. extern FFP phi, theta;
  74. extern int nxpts, nypts;
  75. extern char netplot, axes;
  76. extern struct Window *OpenWindow();
  77. extern struct Screen *OpenScreen();
  78. extern USHORT class, code;
  79. extern struct Window *w;
  80. extern struct RastPort *rp;
  81. extern struct ViewPort *vp;
  82. extern struct IntuiMessage *message;
  83. extern struct Screen *screen;
  84. #endif
  85.  
  86. #ifdef MAIN_MODULE
  87. struct NewScreen ns = {
  88.    0,0,640,400,2,0,3,HIRES | LACE,CUSTOMSCREEN,NULL,"TDP",NULL
  89. };
  90.  
  91. struct NewWindow nw = {
  92.    0,0,640,400,0,3,MENUPICK,ACTIVATE|BORDERLESS|NOCAREREFRESH,
  93.    NULL,NULL,NULL,NULL,NULL,0,0,0,0,CUSTOMSCREEN
  94. };
  95.  
  96. #define MIFlags (ITEMENABLED | ITEMTEXT | HIGHCOMP)
  97. #define ChH 8
  98. #define ChW 8
  99.  
  100. /*** MENU 0 -- PROJECT ****************************************************/
  101. struct IntuiText M_text03 = {1,14,JAM2,0,0,NULL,"Quit    ",NULL};
  102. struct MenuItem M_item03 =
  103.    {NULL,0,3*ChH,ChW*8,ChH,MIFlags,0L,(APTR)&M_text03,NULL,NULL,NULL,0};
  104. #define MI_QUIT 3
  105.  
  106. struct IntuiText M_text02 = {1,14,JAM2,0,0,NULL,"To mCAD ",NULL};
  107. struct MenuItem M_item02 =
  108.    {&M_item03,0,2*ChH,ChW*8,ChH,MIFlags,0L,(APTR)&M_text02,NULL,NULL,NULL,0};
  109. #define MI_TOMCAD 2
  110.  
  111. struct IntuiText M_text01 = {1,14,JAM2,0,0,NULL,"Plot    ",NULL};
  112. struct MenuItem M_item01 =
  113.    {&M_item02,0,ChH,ChW*8,ChH,MIFlags,0L,(APTR)&M_text01,NULL,NULL,NULL,0};
  114. #define MI_PLOT 1
  115.  
  116. struct IntuiText M_text00 = {1,14,JAM2,0,0,NULL,"Open    ",NULL};
  117. struct MenuItem M_item00 =
  118.    {&M_item01,0,0,ChW*8,ChH,MIFlags,0L,(APTR)&M_text00,NULL,NULL,NULL,0};
  119. #define MI_OPEN 0
  120.  
  121. struct Menu Menu0 =
  122.    {NULL,0,0,ChW*8,ChH,MENUENABLED,"Project ",&M_item00};
  123. #define M_PROJECT 0
  124.  
  125. void initwind()
  126. {
  127.    if (!(GfxBase = (struct GfxBase *)OpenLibrary("graphics.library",0)))
  128.       {printf("Can't open graphics library...\n"); exit();}
  129.    if (!(IntuitionBase =
  130.          (struct IntuitionBase *)OpenLibrary("intuition.library",0)))
  131.       {printf("Can't open intuition library...\n"); exit();}
  132.    if (!(screen = OpenScreen(&ns)))
  133.       {printf("Can't open screen...\n"); exit(0);}
  134.  
  135.    nw.Screen = screen;
  136.    if (!(w = OpenWindow(&nw)))
  137.       {printf("Can't open window...\n"); exit(0);}
  138.    rp = w->RPort; vp = &w->WScreen->ViewPort;
  139.    SetRGB4(vp,AXIS_COLOR, 15, 0, 0); SetRGB4(vp,PASS_1_COLOR, 0, 0,15);
  140.    SetDrMd(rp,JAM1); SetAPen(rp,PASS_0_COLOR);
  141.    SetMenuStrip(w,&Menu0); ShowTitle(screen,FALSE);
  142. }
  143.  
  144. void CleanUp()
  145. {
  146.    ClearMenuStrip(w); CloseWindow(w); CloseScreen(screen);
  147.    CloseLibrary(GfxBase); CloseLibrary(IntuitionBase);
  148. }
  149. #endif
  150.